import {
    GET_USERINFO,
    SAVE_ADDRESS
} from './mutation-type'

import {
    getAddressList,
    getUser,
} from '@/service/getData'
export default {
    async getUserInfo({ commit }) {
        let res = getUser()
        commit(GET_USERINFO, res)
    },
    async saveAddress({
        commit,
        state,
    }) {
        if (state.removeAddress.length > 0) return
        let address = await getAddressList(state.userInfo.user_id)
        commit(SAVE_ADDRESS, address)
    }
}
